home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / bin / partman < prev    next >
Encoding:
Text File  |  2007-03-01  |  2.8 KB  |  135 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/definitions.sh
  4.  
  5. abort () {
  6.     if [ -f /var/run/parted_server.pid ]; then
  7.         stop_parted_server
  8.     fi
  9.     exit $1
  10. }
  11.  
  12. db_capb backup
  13.  
  14. # Measure the width of partman/text/number here to make things faster.
  15. # number_width is used only in visual.d/number
  16. db_metaget partman/text/number description
  17. RET=$(printf "$RET" '')
  18. RET=$(stralign 50 "$RET" | sed 's/[^ ]//g')
  19. number_width=$((2 + 50 - ${#RET}))
  20. export number_width
  21.  
  22.  
  23. # Here is maybe not a good place to set deci (TODO)
  24. #db_metaget partman/text/deci description
  25. #deci="$RET"
  26. #export deci
  27.  
  28. # The comma has special meaning for debconf.  Lets force dot untill we
  29. # discover where the comma has to be escaped..
  30. deci='.'
  31.  
  32. # Commented due to #240145
  33. #if [ -e /var/lib/partman ]; then
  34. #    rm -rf /var/lib/partman
  35. #fi
  36.  
  37. mkdir -p /var/lib/partman
  38.  
  39. while true; do
  40.     initcount=$(ls /lib/partman/init.d/* | wc -l)
  41.     db_progress START 0 $initcount partman/progress/init/title
  42.  
  43.     for s in /lib/partman/init.d/*; do
  44.         if [ -x $s ]; then
  45.             #logger -t partman "Running init.d/$s"
  46.  
  47.             base=$(basename $s | sed 's/[0-9]*//')
  48.             # Not every init script has, or needs, its own progress
  49.             # template. Add them to slow init scripts only.
  50.             if ! db_progress INFO partman/progress/init/$base; then
  51.                 db_progress INFO partman/progress/init/fallback
  52.             fi
  53.             if ! $s; then
  54.                 db_progress STOP
  55.                 abort 10
  56.             fi
  57.         fi
  58.         db_progress STEP 1
  59.     done
  60.     db_progress STOP
  61.  
  62.     skip_choose_partition=no
  63.     for s in /lib/partman/auto.d/*; do
  64.         if [ -x $s ]; then
  65.             #logger -t partman "Running auto.d/$s"
  66.             $s
  67.             exitcode=$?
  68.             if [ $exitcode -eq 255 ]; then
  69.                 abort 10 # back up to main menu
  70.             elif [ $exitcode -ge 100 ]; then
  71.                 # Partitioning complete; go straight to
  72.                 # confirmation. (To present choose_partition
  73.                 # so that the user can edit the results of
  74.                 # manual partitioning, just exit 0 instead.)
  75.                 skip_choose_partition=yes
  76.             elif [ $exitcode -ne 0 ]; then
  77.                 continue 2
  78.             fi
  79.         fi
  80.     done
  81.  
  82.     while true; do
  83.         if [ "$skip_choose_partition" != yes ]; then
  84.             ask_user /lib/partman/choose_partition
  85.             exitcode=$?
  86.         else
  87.             exitcode=100
  88.         fi
  89.         if [ $exitcode -eq 255 ]; then
  90.             abort 10 # back up to main menu
  91.         elif [ $exitcode -ge 100 ]; then
  92.             for s in /lib/partman/check.d/*; do
  93.                 if [ -x $s ]; then
  94.                     #logger -t partman "Running check.d/$s"
  95.                     if ! $s; then
  96.                         skip_choose_partition=no
  97.                         continue 2
  98.                     fi
  99.                 fi
  100.             done
  101.             if confirm_changes "partman"; then
  102.                 break
  103.             fi
  104.         fi
  105.         skip_choose_partition=no
  106.     done
  107.  
  108.     if [ "$PARTMAN_NO_COMMIT" ]; then
  109.         exit 0
  110.     fi
  111.  
  112.     for s in /lib/partman/commit.d/*; do
  113.         if [ -x $s ]; then
  114.             #logger -t partman "Running commit.d/$s"
  115.             $s || continue 2
  116.         fi
  117.     done
  118.  
  119.     for s in /lib/partman/finish.d/*; do
  120.         if [ -x $s ]; then
  121.             #logger -t partman "Running finish.d/$s"
  122.             $s || {
  123.                 status=$?
  124.                 if [ "$status" = 1 ]; then
  125.                     continue 2
  126.                 else
  127.                     abort $status
  128.                 fi
  129.             }
  130.         fi
  131.     done
  132.  
  133.     break
  134. done
  135.